import { Component , ViewChild} from '@angular/core';
import {NavController, Nav, IonicPage} from 'ionic-angular';
import {AppService, AppGlobal} from "../../app/app.service";

@IonicPage()
@Component({
  selector: 'page-repository',
  templateUrl: 'repository.html'
})
export class RepositoryPage {
  @ViewChild(Nav) nav: Nav;
  repositorytype: Array<any> = [];
  repository: any;
  rootPage: any = 'RepositoryAllPage';

  params = {
    typeid: "00",
    pageNo: 1,
    pageSize: 20
  }

  constructor(public appService: AppService,public navCtrl: NavController) {
    // used for an example of ngFor and navigation
  }

  ionViewDidLoad() {
    this.getRepositorytype();
    console.log('ionViewDidLoad ProductListPage');
  }

  //获取首页推荐列表
  getRepositorytype() {
    this.appService.httpGet(AppGlobal.API.getRepositorytype, this.params, rs => {
      console.debug(rs);
      this.repositorytype = rs.data;
    })
  }

  openPage(item) {
    // Reset the content nav to have just this page
    // we wouldn't want the back button to show in this scenario
    console.debug(item);
    this.navCtrl.push('RepositoryListPage', { item: item });
  }

}
